<?php

namespace app\api\controller;

use app\admin\model\cms\Video as VideoModel;
use app\admin\model\cms\Live as LiveModel;
use app\common\controller\Api;

/**
 * 直播
 */
class Live extends Api
{
    protected $model;

    protected $noNeedLogin = ['list'];

    public function _initialize()
    {
        parent::_initialize();

        //检测ID是否加密
//        $this->hashids();
    }

    /*
     * 每周视频/每日视频/直接间预告
     */
    public function list()
    {
        $time = strtotime(date('Y-m-d') . ' 00:00:00');
        $live = new LiveModel();
        $live_data = $live->where(['is_top' => 1])->where('live_time','>',$time)->order('id','desc')->find();
        if(!$live_data){
            $live_room = [];
        }else{
            $live_room = $live_data->toArray();
            $live_room['image'] = obsurl($live_room['image']);
        }
        $this->success('', ['live_room' => $live_room]);

    }


}
